package com.hzdl.car.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hzdl.car.bean.Car;
import com.hzdl.car.bean.Customer;
import com.hzdl.car.bean.Rent;
import com.hzdl.car.mapper.RentMapper;
import com.hzdl.car.service.RentService;
import com.hzdl.car.vo.RentVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RentServiceimpl implements RentService {
    @Autowired
    private RentMapper mapper;

    @Override
    public int add(RentVo rentVo) {
        return mapper.add(rentVo);
    }

    @Override
    public Customer findById(String identity) {
        return mapper.findById(identity);
    }

    @Override
    public PageInfo<Rent> findWhere(RentVo rentVo) {
        PageHelper.startPage(rentVo.getPage(),rentVo.getLimit());
        List<Rent> list = mapper.findWhere(rentVo);
        return new PageInfo<>(list);
    }

    @Override
    public int update(RentVo rentVo) {
        return mapper.update(rentVo);
    }

    @Override
    public int delete(String rentid) {
        return mapper.delete(rentid);
    }

    @Override
    public Car findByrentId(String rentid) {
        return mapper.findByrentId(rentid);
    }

    @Override
    public Rent findByIdrent(String rentid) {
        return mapper.findByIdrent(rentid);
    }
}
